execute store result score #HP temp run data get entity @s item.components."minecraft:custom_data".guardTowerData.HP
$execute store result entity @s item.components."minecraft:custom_data".guardTowerData.HP int 1 run scoreboard players remove #HP temp $(value)

execute if score #HP temp matches ..0 run function vs:system/game_ctrol/guard_tower/break

execute as @n[tag=guardTower.healthDisplay,distance=..5,type=text_display] at @s run function vs:system/game_ctrol/guard_tower/health/update_display

scoreboard players reset #HP temp